import { ecs } from "db://oops-framework/libs/ecs/ECS";
import { Scene } from "../Scene";
import { ViewUtil } from "db://oops-framework/core/utils/ViewUtil";
import { oops } from "db://oops-framework/core/Oops";
import { MapViewComp } from "../view/MapViewComp";

/** 
 * 加载地形资源 
 */
@ecs.register('MapLoad')
export class MapLoadComp extends ecs.Comp {
    reset() { }
}

export class MapLoadSystem extends ecs.ComblockSystem implements ecs.IEntityEnterSystem {
    filter(): ecs.IMatcher {
        return ecs.allOf(MapLoadComp);
    }
    entityEnter(e: Scene): void {
         // 创建地图显示对象
         var node = ViewUtil.createPrefabNode(`game/scene`);
         let comp = node.getComponent(MapViewComp)!;
         e.add(comp);
 
         // 显示地图
         node.parent = oops.gui.game;

         e.loadBattleData(1);
    }
}